#include "Classes.h"

// instantiate Game object and setup static pointer for all Object classes
Game* Object::Zelda = new Game();

int main() {
	Player* Link = new Player(50,50,GreenCloak,SmallShield,WoodenSword);
	Game* Zelda = Object::Zelda;
	Zelda->setPlayer(Link);

	// setup GamePad
	if(Zelda->Receiver->IsJoystickActive()) {
		Controller* ZeldaPad = new Controller(Zelda->Receiver->JoystickInfo[0].Axes);
	}

	// seed random function
	srand((unsigned int)time(NULL));

	Zelda->Objects.push_back(Link);

	// game loop
	while(Zelda->Device->run()) {
		
		// begin scene
		Zelda->Driver->beginScene(true,true,Colour::QuadrantTan);
		
		// throttle CPU
		Zelda->Device->yield();

		//actually does stuff and things
		for(unsigned int i = 0; i < Zelda->Objects.size(); i ++) {
			Zelda->Objects[i]->Act();
			Zelda->Objects[i]->Draw();
		}

		// ESC to exit
		if(Zelda->Receiver->IsKeyClicked(KEY_ESCAPE)) goto exit;
		
		// end scene
		Zelda->Driver->endScene();
	}
exit:
	Zelda->Sound->drop();
	Zelda->Driver->drop();
	return 0;
}